package service.impl;

import entity.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import repository.LogRepository;
import service.LogService;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogRepository logRepository;

    public Integer save(Object o) {
        Log log = (Log) o;
        return logRepository.save(log);
    }

    public List findAll() {
        return logRepository.findAll();
    }

    public void delete(Integer id) {
        logRepository.delete(id);
    }

    public Integer update(Object o) {
        Log log = (Log) o;
        logRepository.saveOrUpdate(log);
        return log.getId();
    }
}
